
function Main() {
    if (!new.target || !Crafty) {
        throw Error("const");
    }
    Crafty.init(1920, 800, document.getElementById("game"));
    Crafty.e("platform,2D,Canvas,Color")
        .attr({
            x: 0,
            y: 720,
            w: 1920,
            h: 24
        }).color("#ff00ff");
    let b = Crafty.e("2D,Canvas,Color,Twoway,Gravity,Collision,player")
        .attr({
            x: 0, y: 10, w: 80, h: 99
        })
        .color("#FFFF00")
        .twoway(10)
        .gravityConst(750)
        .gravity('platform')
        .onHit('platform',function(data){
            console.log(data);
        })
        // console.log(b.destroy());

}

new Main();